<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head> 
    <meta charset="UTF-8">
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
    <link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
    <c:set var="statusWaitAccept" value="<%=ResourcesUtil.getConfig(\"reserver_meterial_wait_accept\")%>" />
    <c:set var="statusAcceptOk" value="<%=ResourcesUtil.getConfig(\"reserver_meterial_ok\")%>" />
    <script>
    var statusWaitAccept = "${statusWaitAccept}";
    var statusAcceptOk = "${statusAcceptOk}";

    $(function(){
        $(".tabBox ul li").each(function(){
            var index=$(this).index();

            $(".tabBox ul li").eq(0).addClass("active");

            $(this).click(function(){

                $(this).addClass("active").siblings().removeClass("active");

                $(".tabBoxSm > .tabSm").eq(index).stop(true).show().siblings().stop(true).hide();
				
				var tableW = $(".tabBoxSm > .tabSm").eq(index).find('.tableHead').width();
				var tabodyH = $(".tabBoxSm > .tabSm").eq(index).find('.tableBody').height();
				var tableScrollH = $(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').height();
				if(tabodyH>tableScrollH){
					$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width',tableW + 18 + 'px');
				}else{
					$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width','inherit');
				}
            });
        });
        $("select").select2();
        
        if(${handBook.handbookAuditStatus == statusWaitAccept} || ${handBook.handbookAuditStatus == statusAcceptOk}){
        	funBtnDisable();
        }
    });
    
    //删除方法
    function delHandBook(){
          // 调用后台删除方法
        $.post("${ctx}/purchase/handbook/delete?id=${handBook.id}",'',function(result){
             // 提示信息
             tipParent(result.message);
             // 返回状态
            if(result.statusCode==STATUSCODEOK){
                 // 刷新页面
                window.parent.frames[0].searchListForm();
                 // 关闭页面
                closeWin(); 
             }
        },'json');
   }
    
    function funBtnDisable(){
    	$("#btnDel").hide();
    	$("#btnEdit").hide();
    }
    
    function funBtnEnable(){
    	$("#btnDel").show();
    	$("#btnEdit").show();
    }
    </script> 
</head>
<body>
<div class="layerHeader clearfix">
	<p class="headerTitle"><spring:message code="handBook_show_title"/></p>
    <div class="headerButton clearfix">
        <c:if test="${handBook.deleteFlag != 1}">
        <shiro:hasPermission name="purchase:handbook:edit">	
        	<button type="button" id="btnDel" onclick="del(delHandBook)"><spring:message code="role_delete"/></button>
        </shiro:hasPermission>
        <shiro:hasPermission name="purchase:handbook:audit">	
        	<button type="button" onclick="popup('800px','519px','${ctx}/purchase/handbook/audit?id=${handBook.id}')"><spring:message code="handBook_show_button_audit"/></button>
        </shiro:hasPermission>
        <shiro:hasPermission name="purchase:handbook:edit">	
        	<button type="button" id="btnEdit" onClick="window.location.href='${ctx}/purchase/handbook/form?id=${handBook.id}'"><spring:message code="write_style_btn"/></button>
        </shiro:hasPermission>
        </c:if>
        <button type="button" onclick="closeWin()"><spring:message code="btn_cancle"/></button>
    </div>
</div>
<div class="tabBox">
    <ul class="clearfix">
     	<li class="active" style="width:100px"><spring:message code="handBook_create_tab_export"/></li>
        <li style="width:100px" id="importLi"><spring:message code="handBook_create_tab_import"/></li>
    </ul>
    <p class="tab-a" style="right:470px"><spring:message code="handBook_create_export_num"/><fmt:formatNumber value="${handBook.handbookExportNumber}" pattern="#,##0.#####"/></p>
    <p class="tab-a" style="right:320px"><spring:message code="handBook_create_export_sum"/><fmt:formatNumber value="${handBook.handbookExportSum}" pattern="#,##0.00###"/></p>
    <p class="tab-a" style="right:170px"><spring:message code="handBook_create_import_num"/><fmt:formatNumber value="${handBook.handbookImportNumber}" pattern="#,##0.#####"/></p>
    <p class="tab-a"><spring:message code="handBook_create_import_sum"/><fmt:formatNumber value="${handBook.handbookImportSum}" pattern="#,##0.00###"/></p>
</div>
		<div class="tabBoxSm">
		    <div class="tabSm">
		    	<div class="tableArea">
		        	<div class="tableScroll tableScrollSm" style="width:890px;height:387px;">
		        		<table cellpadding="0" class="tableHead">
		                    <thead>
		                    <tr>
		                    	<th><p class="tab-cz"><spring:message code="handBook_create_head_operate"/></p></th>
		                        <th><p style="width:100px"><spring:message code="handBook_create_head_indent_no"/></p></th>
		                        <th><p style="width:100px"><spring:message code="handBook_create_head_style_no"/></p></th>
		                        <th><p style="width:80px"><spring:message code="handBook_create_head_size"/></p></th>
		                        <th><p style="width:100px"><spring:message code="handBook_create_head_style_name"/></p></th>
		                        <th style="width:70px"><spring:message code="handBook_create_head_num"/></th>
		                        <th><p style="width:40px"><spring:message code="handBook_create_head_unit"/></p></th>
		                        <th><p style="width:40px"><spring:message code="handBook_create_head_currency"/></p></th>
		                        <th><p style="width:70px"><spring:message code="handBook_create_head_price"/></p></th>
		                        <th><p style="width:70px"><spring:message code="handBook_create_head_amount"/></p></th>
		                        <th><p style="width:80px"><spring:message code="handBook_create_head_export"/></p></th>
		                        <th><p style="width:80px"><spring:message code="handBook_create_head_remark"/></p></th>
		                    </tr>
		                    </thead>
		                </table>
		                <!-- 出口成品明细 -->
		                <table cellpadding="0" class="tableBody">
							<c:if test="${not empty handBook.exportDetailsList}">
								<tbody>
									<c:forEach items="${handBook.exportDetailsList}" var="exportDetails" varStatus="exportStatus">
										<tr>
										    <!-- 删除 -->
											<td><p class="tab-cz"></p></td>
											
											<!-- 合同订单编号 -->
											<td><p style="width:100px" class='text_overflow' data-toggle='tooltip' title='${exportDetails.indentNo}'>${exportDetails.indentNo}</p></td>
											
											<!-- 款式编号 -->
											<td><p style="width: 100px" class='text_overflow' data-toggle='tooltip' title='${exportDetails.styleCustomerNo}'>${exportDetails.styleCustomerNo}</p></td>
											
											<!-- 尺码 -->
											<td><p style="width: 80px" class='text_overflow' data-toggle='tooltip' title='${exportDetails.styleSize}'>${exportDetails.styleSize}</p></td>
											
											<!-- 款式名称 -->
											<td><p style="width: 100px" class='text_overflow' data-toggle='tooltip' title='${exportDetails.styleNameCn}'>${exportDetails.styleNameCn}</p></td>
											
											<!-- 数量 -->
											<td style="width: 70px"><fmt:formatNumber value="${exportDetails.handbookQuantity}" pattern="#,##0.#####"/></td>
											
											<!-- 单位 -->
											<td><p style="width: 40px"><spring:message code="handBook_create_detail_unit"/></p></td>
											
											<!-- 币种 -->
											<td><p style="width: 40px">${exportDetails.handbookCurrency}</p></td>
											
											<!-- 单价 -->
											<td><p style="width: 70px"><fmt:formatNumber value="${exportDetails.handbookPrice}" pattern="#,##0.00###"/></p></td>
											
											<!-- 总值 -->
											<td><p style="width: 70px"><fmt:formatNumber value="${exportDetails.handbookAmount}" pattern="#,##0.00###"/></p></td>
											
											<!-- 出口国 -->
											<td><p style="width: 80px">${fns:getDictName(exportDetails.handbookExportsCd)}</p></td>
                                            
											<!-- 合同备注 -->
											<td><p style="width: 80px" class='text_overflow' data-toggle='tooltip' title='${exportDetails.remarks}'>${exportDetails.remarks}</p></td>
										</tr>
									</c:forEach>
								</tbody>
							</c:if>
						</table>
		            </div>
		        </div>
			</div>
		    <div class="tabSm none">
		    	<div class="tableArea">
		        	<div class="tableScroll tableScrollSm" style="width:880px;height:387px;">
		        		<table cellpadding="0" class="tableHead">
		                    <thead>
		                    <tr>
		                        <th><p class="tab-cz"><spring:message code="handBook_create_head_operate"/></p></th>
		                        <th><p style="width:100px"><spring:message code="handBook_create_head_indent_no"/></p></th>
		                        <th><p style="width:100px"><spring:message code="handBook_create_head_style_no"/></p></th>
		                        <th><p style="width:100px"><spring:message code="handBook_create_head_material_name"/></p></th>
		                        <th><p style="width:80px"><spring:message code="handBook_create_head_spec"/></p></th>
		                        <th style="width:70px"><spring:message code="handBook_create_head_num"/></th>
		                        <th><p style="width:40px"><spring:message code="handBook_create_head_unit"/></p></th>
		                        <th><p style="width:40px"><spring:message code="handBook_create_head_currency"/></p></th>
		                        <th><p style="width:70px"><spring:message code="handBook_create_head_price"/></p></th>
		                        <th><p style="width:70px"><spring:message code="handBook_create_head_amount"/></p></th>
		                        <th><p style="width:80px"><spring:message code="handBook_create_head_origin"/></p></th>
		                        <th><p style="width:80px"><spring:message code="handBook_create_head_import"/></p></th>
		                    </tr>
		                    </thead>
		                </table>
		                <!-- 进口料件明细 -->
		                <table cellpadding="0" class="tableBody">
							<c:if test="${not empty handBook.importDetailsList}">
								<tbody>
									<c:forEach items="${handBook.importDetailsList}" var="importDetails" varStatus="importStatus">
										<tr>
										    <!-- 删除 -->
											<td><p class="tab-cz"></p></td>
											
											<!-- 合同订单编号 -->
											<td><p style="width:100px" class='text_overflow' data-toggle='tooltip' title='${importDetails.indentNo}'>${importDetails.indentNo}</p></td>
											
											<!-- 款式编号 -->
											<td><p style="width: 100px" class='text_overflow' data-toggle='tooltip' title='${importDetails.styleCustomerNo}'>${importDetails.styleCustomerNo}</p></td>
											
											<!-- 物料名称 -->
											<td><p style="width: 100px" class='text_overflow' data-toggle='tooltip' title='${importDetails.materialNameCn}'>${importDetails.materialNameCn}</p></td>
											
											<!-- 规格型号 -->
											<td><p style="width: 80px">${importDetails.materialSpec}</p></td>
											
											<!-- 数量 -->
											<td style="width: 70px"><fmt:formatNumber value="${importDetails.handbookQuantity}" pattern="#,##0.#####"/></td>
											
											<!-- 单位 -->
											<td><p style="width: 40px">${fns:getDictName(importDetails.unitCd)}</p></td>
											
											<!-- 币种 -->
											<td><p style="width: 40px">${importDetails.handbookCurrency}</p></td>
											
											<!-- 单价 -->
											<td><p style="width: 70px"><fmt:formatNumber value="${importDetails.handbookPrice}" pattern="#,##0.00###"/></p></td>
											
											<!-- 总值 -->
											<td><p style="width: 70px"><fmt:formatNumber value="${importDetails.handbookAmount}" pattern="#,##0.00###"/></p></td>
											
											<!-- 原产国 -->
											<td><p style="width: 80px">${fns:getDictName(importDetails.handbookImportCd2)}</p></td>
                                            
											<!-- 进口国 -->
											<td><p style="width: 80px">${fns:getDictName(importDetails.handbookExportsCd)}</p></td>
										</tr>
									</c:forEach>
								</tbody>
							</c:if>
		                </table>
		            </div>
		        </div>
		    </div>
		</div>
</body>
</html>